package Day23;
import java.util.*;

public class A2 {


    /**
     * 给字符串分组。异位词为一组
     * @param args
     */

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNextInt()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            String[] s = new String[n];
            for(int i=0;i<n;i++) {
                s[i] = in.next(); //输入字符串
                char[] str = s[i].toCharArray(); //1.转成字符数组
                Arrays.sort(str);
                s[i] = new String(str);
            }
            Set<String> set = new HashSet<>();
            for(String x:s) {
                set.add(x);
            }
            System.out.println(set.size());
        }
    }
}
